package com.stefan.service.impl;


import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.util.HashSet;
import java.util.List;
import java.util.logging.Handler;

@SpringBootTest
@ExtendWith(SpringExtension.class)
public class CitiNewsServiceImplTester {
    @Autowired
    private  CitiNewsServiceImpl citiNewsService;

    // 测试添加新闻
    @Test
    public void testAddNews() {
        citiNewsService.addNews(List.of("News1", "News2", "News3", "News4", "News5"));
    }
    // 测试获取新闻
    @Test
    public void testGetNews() {
        HashSet<String> news = citiNewsService.getNews();
        System.out.println("Retrieved news: " + news);
    }
    // 测试获取新闻及其分数
    @Test
    public void testGetNewsWithScores() {
        HashSet newsWithScores = citiNewsService.getNewsWithScores();
        System.out.println("Retrieved news with scores: " + newsWithScores);
    }

}


